<template>
  <div>
    <ZgEdit
      ref="dialog"
      :view="{ width: '60%', top: '5%', title: '新增推送配置' }"
      :columns="columns"
      :formulas="formulas"
      :layout="layout"
      validUrl=""
      @ok="onOk"
      saveUrl="">
    </ZgEdit>
  </div>
</template>
<script>
export default {
  props: {
    viewId: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      layout: {
        视图边距: 10, 标签宽度: 120, 标签对齐: 'right', 左右间距: 10, 上下间距: 10
      },
      columns: [
        { code: 'taskName', compType: '单行文本', name: '任务名称', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '任务名称是必填啊' },
        { name: '目标系统', code: 'targetSystem', compType: '下拉选择', isNeed: true, offset: 0, span: 12, defaultVal: '1', extra: { 下拉选项: [{ value: '1', label: '虚拟仓' }, { value: '2', label: '交易' }] } },
        { code: 'taskName', compType: '单行文本', name: '目标接口', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '目标参数', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '目标数据库', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '目标表', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '数据选择逻辑', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '数据转换逻辑', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '数据映射逻辑', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { code: 'taskName', compType: '单行文本', name: '推送方式', isNeed: true, offset: 0, span: 12, defaultVal: '', regex: '', errorMsg: '' },
        { name: '生效时间', code: 'last_login_time', compType: '日期时间', isNeed: true, offset: 0, span: 12, defaultVal: '' }
        // { name: '头像', code: 'head', compType: '图片', isNeed: true, offset: 0, span: 24, defaultVal: '' },
        // { name: '照片', code: 'photo', compType: '多图', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { note: '这里是描述信息' } },
        // { name: '性别', code: 'sex', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 字典类型: 'sex' } },
        // { name: '下拉选择', code: 'select', compType: '下拉选择', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 下拉选项: [{ value: '1', label: '男' }, { value: '2', label: '女' }] } },
        // { name: '姓名', code: 'name', compType: '单行文本', isNeed: true, offset: 0, span: 24, defaultVal: 'zxb', regex: '', errorMsg: '' },
        // { name: '简介', code: 'intro', compType: '多行文本', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 行数: 3 } },
        // { name: '个人经历', code: 'info', compType: '富文本', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 高度: 400 } },
        // { name: '年龄', code: 'age', compType: '整数', isNeed: true, offset: 0, span: 24, defaultVal: 0 },
        // { name: '分数', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 24, defaultVal: 0 },
        // { name: '是否测试账号', code: 'is_test', compType: '单选框', isNeed: true, offset: 0, span: 24, defaultVal: false },
        // { name: '政治面貌', code: 'political', compType: '多选', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'political' } },
        // { name: '是否启用', code: 'is_use', compType: '开关', isNeed: true, offset: 0, span: 24, defaultVal: false },
        // { name: '生日', code: 'birth', compType: '日期', isNeed: true, offset: 0, span: 24, defaultVal: '2025-05-22' },
        // { name: '最后登录时间', code: 'last_login_time', compType: '日期时间', isNeed: true, offset: 0, span: 24, defaultVal: '2025-05-22 12:00:00' }
      ],
      formulas: [
        // { triggerMode: '初始化时', name: '公式1', content: 'console.log("init");' },
        // { triggerMode: '数据变化时', name: '公式2', content: 'console.log("update");' },
        // { triggerMode: '提交时', name: '公式3', content: 'console.log("submit");' }
      ]
    }
  },
  watch: {
    viewId () {
      this.fetchView()
    }
  },
  mounted () {
    this.fetchView()
  },
  methods: {
    open () {
      this.$refs.dialog.open()
    },
    fetchView () {
      // if (!this.viewId || this.viewId.length === 0) {
      //   return
      // }
      // this.$http.get('/zg-autoform/view/findById', { id: this.viewId }, res => {})
    },
    onOk () {
      console.log('onOk', '这是indiv下pushTask 路径下名为 Add.vue的文件中的第 81 行🤺🤺🤺')
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
